/**
 * @作者 Luke
 * @微信公号 欧诺的小书屋
 * @开源项目 $ http://7yue.pro
 * @免费专栏 $ http://course.7yue.pro
 * @我的课程 $ http://imooc.com/t/4294850
 * @创建时间 2020-6-21 22:26
 */
package io.github.talelin.latticy.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import io.github.talelin.latticy.model.ChapterDO;
import io.github.talelin.latticy.model.ChapterDetailDO;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface ChapterMapper extends BaseMapper<ChapterDO> {

    /**
     * 查询课程章节
     * @param courseId 课程id
     * @return List<ChapterDetailDO>
     */
    List<ChapterDetailDO> getChaptersByCourseId(
            @Param(value = "courseId") Long courseId);

    /**
     * 根据courseId 统计当前课程一共有多少个大章
     * @param courseId 课程id
     * @return  int
     */
    int getCountByCourseId(Long courseId);

    /**
     * 只查询大章
     * @param courseId 课程id
     * @return  ChapterDO
     */
    List<ChapterDO> findChaptersByCourseId(@Param(value = "courseId") Long courseId);
}
